<?php 
require_once('Admin/Model/sessionModel.php'); 
require_once('Admin/Controller/Controller.php'); 

class SessionController extends Controller{
	function __Construct(){
		parent::__Construct();
		//$this->model = new UserModel();
	}


public function session(){
	session_start();
	$username = $_POST["username"];
  $pwd = $_POST["pwd"];
	$model= new SessionModel();
	$data = $model->session($username,$pwd);
  
	if ($data) 
  {	 
    $_SESSION['user']=$data;
	  //3秒后转向用户列表页面
    echo '<a href="admin.php?c=user&m=listusers">登录成功!</a>';
    header("refresh:3;url='admin.php?c=user&m=listusers'");
	  
  }
  else
  {
    echo '<a href="admin.php?c=session&m=login">用户名或密码错误！请重新登录！</a>';
    header("refresh:3;url='admin.php?c=session&m=login'");
	 
  } 

}

  function login(){
  	include 'Admin/View/login.php';
  }

}



?>